package com.atguigu.consumeruser.controller;

import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @author : wenchao.long
 * @date : Created in 2020/12/07 16:47 周一
 * @description :
 */
@RestController
@AllArgsConstructor
public class ConsumerUserController {

    private final RestTemplate restTemplate;

    @GetMapping("/buy")
    public String buyTicket(@RequestParam("name") String name) {
        String template = restTemplate.getForObject("http://PROVIDER-TICKET/ticket", String.class);
        return name + "购买了" + template;
    }

}
